import { useSelector } from 'react-redux'
import { StateType } from '../store'
import { ComponentStateType } from '../store/componetnsReducer'
function useGetComponentInfo() {
  // const components = useSelector<StateType>(state => state.components) as ComponentStateType
  const components = useSelector<StateType>(state => state.components.present) as ComponentStateType //增加undo
  const { componetnList = [], selectedId, copiedComponent } = components
  const selectedCopmonent = componetnList.find(item => item.fe_id === selectedId) || null

  return { componetnList, selectedId, selectedCopmonent, copiedComponent }
}
export default useGetComponentInfo
